package com.example.comzg24_2

import android.content.Context
import android.content.Intent
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.widget.ImageView
import androidx.core.view.isVisible
import androidx.viewpager.widget.ViewPager.OnPageChangeListener
import com.bumptech.glide.Glide
import com.example.base.url.mvvm.BaseViewActivity
import com.example.comzg24_2.databinding.ActivityWelBinding
import com.example.comzg24_2.login.LoginActivity
import com.youth.banner.loader.ImageLoader

class WelActivity : BaseViewActivity<ActivityWelBinding>() {
    val list = mutableListOf<String>()
    override fun initView() {
        list.add("https://developer.huawei.com/allianceCmsResource/resource/HUAWEI_Developer_VUE/images/homeNew/banner4-1124.jpg")
        list.add("https://developer.huawei.com/images/new-content/develop/img_DLP_develop_gailan_deveco_studio.png")
        list.add("https://developer.huawei.com/images/new-content/Promotion-and-Monetization/ads-12800500.png")

        binding.bar.setImages(list)
        binding.bar.setImageLoader(object : ImageLoader(){
            override fun displayImage(context: Context, path: Any, imageView: ImageView) {
                Glide.with(context).load(path).into(imageView)
            }
        }).start()

        binding.bar.setOnPageChangeListener(object : OnPageChangeListener{
            override fun onPageScrolled(
                position: Int,
                positionOffset: Float,
                positionOffsetPixels: Int
            ) {

            }

            override fun onPageSelected(position: Int) {
                binding.btn.isVisible = position==2
            }

            override fun onPageScrollStateChanged(state: Int) {

            }
        })

        binding.btn.setOnClickListener {
            startActivity(Intent(this,LoginActivity::class.java))
        }


    }

    override fun initData() {

    }

    override fun getLayout(): Int {
        return R.layout.activity_wel
    }
}